function EditCtrl($scope)
{
    var SWITCH_METHOD = 'http://software-site:70/php/test.php';
    var id  = window.location.search.split('=')[1];
    $scope.CurrId = id;
    $scope.EditProduct = {};
    var GetEditProduct = function()
    {
        var id = $scope.CurrId;
        var data = {Id : id};
        $.post(SWITCH_METHOD, {method: 'GetCurrentProduct', data: data}, function (response) {
            var prod = JSON.parse(response)[0];
            $scope.EditProduct = prod;
            $scope.$apply();
            console.log($scope.EditProduct);
        });
    };1
    $scope.Categories = {};
    var GetAllCategories = function(){
        $.post(SWITCH_METHOD,{method : 'getCategories'}, function (response) {
            $scope.Categories = JSON.parse(response);
            $scope.$apply();

        });
    };


$scope.saveChanges = function()
{
    console.log($scope.EditProduct);
    $.post(SWITCH_METHOD,{method : 'UpdateProduct', data: $scope.EditProduct }, function (response) {
        document.location.href='../../Panel/ProductPanel.php';
    });
};



    GetAllCategories();
    GetEditProduct();
}

